package top.korori.api.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.korori.common.model.Result;
import top.korori.sv.entity.bo.SvLoginBo;
import top.korori.sv.service.SvAuthService;
@Api(tags = "身份认证")
@RestController
@RequestMapping("/sv/auth")
public class SvAuthController {

    @Autowired
    private SvAuthService svAuthService;

    @ApiOperation("用户登录和注册")
    @PostMapping("/login")
    public Result<?> login(@RequestBody SvLoginBo svLoginBo){
        String token = svAuthService.login(svLoginBo);
        return Result.okAndPut("token",token);
    }


    @ApiOperation(value = "发送登录注册验证码")
    @GetMapping("/sendLoginCode/{phone}")
    public Result<String> sendLoginCode(@PathVariable String phone){
        String msg = svAuthService.sendLoginCode(phone);
        return Result.ok(msg);
    }

}





































